# -*- coding: utf-8 -*-
"""
__author__ = 'bingo'
__date__ = '2019/3/15'
# code is far away from bugs with the god animal protecting
    I love animals. They taste delicious.
              ┏┓      ┏┓
            ┏┛┻━━━┛┻┓
            ┃      ☃      ┃
            ┃  ┳┛  ┗┳  ┃
            ┃      ┻      ┃
            ┗━┓      ┏━┛
                ┃      ┗━━━┓
                ┃  神兽保佑    ┣┓
                ┃　永无BUG！   ┏┛
                ┗┓┓┏━┳┓┏┛
                  ┃┫┫  ┃┫┫
                  ┗┻┛  ┗┻┛
"""

from datetime import datetime
from django import template

register=template.Library()

@register.filter(name='customTimeFmt')
def customTimeFmt(value):
    """
    自定义的日期时间过滤器，返回自定义格式的字符串
    :param value:
    :return:
    """
    if isinstance(value,datetime):
        return value.strftime('%Y年%m月%d %H:%M')

    else:
        return value